import * as types from '../../constant/mutations_type'
import homeState from '../state/homeState'
import { addData, getData } from '@/util/localData'        //token存取方法
import { mapMutations, mapGetters, mapActions } from 'vuex'  

const mutation = {
    // [types.SEL_USERINFO](state, singer) {                          //查询用户活动信息  
    //     console.log("mutation=="+types.SEL_USERINFO+">>>>>>")
    //     console.log(JSON.stringify(singer.data.data))
    //     state.userInfo = singer.data.data
    //     if(singer.data.data){
    //         addData("userTreeId",singer.data.data.id);
    //         if(singer.data.data.treeNum>=5){
    //             state.userInfo.treeType = 'tree-max'
    //         }else{
    //             state.userInfo.treeType = 'tree-min'
    //         }
    //         if(singer.data.data.wateringCount!=null&&singer.data.data.wateringCount>=3){
    //             state.userInfo.treeState = 'bqs'
    //         }else{
    //             state.userInfo.treeState = 'qs'
    //         }
    //     }else{
    //         state.userInfo = homeState.userInfo
    //     }
    // },
    // [types.SEL_USER_PRIZE](state, singer) {                          //查询用户活动信息        
    //     console.log("mutation=="+types.SEL_USER_PRIZE+">>>>>>")
    //     console.log(JSON.stringify(singer.data.data))
    //     state.userInfo = singer.data.data
    //     if(!singer.data.data){
    //         state.userInfo = homeState.userInfo
    //     }
    // },
    // [types.SEL_USER_PLANT](state, singer){                       //种树记录
    //     console.log("mutation=="+types.SEL_USER_PLANT+">>>>>>")
    //     console.log(JSON.stringify(singer.data.data))
    //     if(!singer.data.data){
    //         state.plant_record = []
    //         state.plant_record_page = 1
    //     }else{
    //         if(singer.data.data.pageNum!="1"){
    //             state.plant_record = state.plant_record.concat(singer.data.data.list)
    //             state.plant_record_page = singer.data.data.pageNum
    //             state.plant_record_pages = singer.data.data.pages
    //         }else{
    //             state.plant_record = singer.data.data.list
    //             state.plant_record_page = singer.data.data.pageNum
    //             state.plant_record_pages = singer.data.data.pages
    //         }
    //     }
    // },
    [types.SEL_RULE](state, singer){
        console.log("mutation=="+types.SEL_RULE+">>>>>>")
        state.rule = singer.data.data
        state.gz_show = true
    },
    [types.SHOW_SUPER_MAN](state, singer) {                          //设置消息显示    
        state.superman_show = true  
    },
    [types.HIDE_SUPER_MAN](state, singer) {                          //设置消息隐藏       
        state.superman_show = false  
    },
    [types.SHOW_GZ](state, singer) {                          //设置消息显示    
        state.gz_show = true  
    },
    [types.HIDE_GZ](state, singer) {                          //设置消息隐藏       
        state.gz_show = false  
    },
    [types.SHOW_MSG](state, singer) {                          //设置消息显示    
        state.msg_show = true  
    },
    [types.HIDE_MSG](state, singer) {                          //设置消息隐藏       
        state.msg_show = false  
    },
}
export default mutation